#include <Model\Include\Paddle.h>


Paddle::Paddle(const float &pos_x, const float &pos_y, const float &width, const float &height)
    :GameObject(pos_x, pos_y, 0.0f)
{
    this->width = width;
    this->height = height;
    this->velocity = 5.0f;
    this->movement_type = PaddleMovementType::STATIC;
}

Paddle::~Paddle(void)
{
}

void Paddle::setVelocity(const float &velocity)
{
    this->velocity = velocity;
}

void Paddle::setMovementType(const PaddleMovementType &movement)
{
    this->movement_type = movement;
}

void Paddle::move(const float &delta_time)
{
    float movement_auxi = 0.0f;
    switch (this->movement_type)
    {
    case PaddleMovementType::STATIC:
        return;
        break;
    case PaddleMovementType::RIGHT:
        movement_auxi = 1.0f;
        break;
    case PaddleMovementType::LEFT:
        movement_auxi = -1.0f;
        break;

    }
    float delta_movement = velocity /*units/sec*/ * delta_time /*msec*/ * 0.001f /*sec/msec*/ * movement_auxi;
    this->setPosition(this->getPositionX(), this->getPositionY() + delta_movement);
}

float Paddle::getWidth()
{
    return this->width;
}

float Paddle::getHeight()
{
    return this->height;
}